package ua.com.alus.resvac.crm.domen.entities;

import net.sourceforge.stripes.action.FileBean;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;

/**
 * ResumeFile
 * <p/>
 * Created by Usatov Alexey
 */
@Entity
@Table(name = "VACANCY_FILE")
public class VacancyFile extends BaseEntity implements Serializable {

    public static final String NATIVE_DELETE_VACANCY_FILE = "DELETE FROM VACANCY_FILE WHERE PK_UUID=?";
    public static final String NATIVE_SELECT_VACANCY_FILES_UUID = "SELECT PK_UUID FROM VACANCY_FILE WHERE VACANCY_PK_UUID=?";

    @Column(name = "VACANCY_PK_UUID", insertable = false, updatable = false)
    private String entityUuid;

    @ManyToOne
    @JoinColumn(name = "VACANCY_PK_UUID", referencedColumnName = "PK_UUID")
    private Vacancy vacancy;

    @Lob
    @Column(name = "FILE")
    private byte[] file;

    @Transient
    private FileBean fileBean;

    public byte[] getFile() {
        return file;
    }

    public void setFile(byte[] file) {
        this.file = file;
    }

    public FileBean getFileBean() {
        return fileBean;
    }

    public void setFileBean(FileBean fileBean) {
        this.fileBean = fileBean;
    }

    public String getEntityUuid() {
        return entityUuid;
    }

    public void setEntityUuid(String entityUuid) {
        this.entityUuid = entityUuid;
    }

    public Vacancy getVacancy() {
        return vacancy;
    }

    public void setVacancy(Vacancy vacancy) {
        this.vacancy = vacancy;
    }
}
